package com.whisper.application.service.service.impl;

import java.util.List;
import com.whisper.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.whisper.application.service.mapper.VrApplyMapper;
import com.whisper.application.service.domain.VrApply;
import com.whisper.application.service.service.IVrApplyService;

import static com.whisper.common.security.util.SecurityUtils.getUsername;

/**
 * 用户活动申请Service业务层处理
 * 
 * @author whisper
 * @date 2024-01-07
 */
@Service
public class VrApplyServiceImpl implements IVrApplyService 
{
    @Autowired
    private VrApplyMapper vrApplyMapper;

    /**
     * 查询用户活动申请
     * 
     * @param id 用户活动申请主键
     * @return 用户活动申请
     */
    @Override
    public VrApply selectVrApplyById(Long id)
    {
        return vrApplyMapper.selectVrApplyById(id);
    }

    /**
     * 查询用户活动申请列表
     * 
     * @param vrApply 用户活动申请
     * @return 用户活动申请
     */
    @Override
    public List<VrApply> selectVrApplyList(VrApply vrApply)
    {
        return vrApplyMapper.selectVrApplyList(vrApply);
    }

    /**
     * 新增用户活动申请
     * 
     * @param vrApply 用户活动申请
     * @return 结果
     */
    @Override
    public int insertVrApply(VrApply vrApply)
    {
        vrApply.setCreateTime(DateUtils.getNowDate());
        vrApply.setCreateBy(getUsername());
        return vrApplyMapper.insertVrApply(vrApply);
    }

    /**
     * 修改用户活动申请
     * 
     * @param vrApply 用户活动申请
     * @return 结果
     */
    @Override
    public int updateVrApply(VrApply vrApply)
    {
        vrApply.setUpdateTime(DateUtils.getNowDate());
        vrApply.setUpdateBy(getUsername());
        return vrApplyMapper.updateVrApply(vrApply);
    }

    /**
     * 批量删除用户活动申请
     * 
     * @param ids 需要删除的用户活动申请主键
     * @return 结果
     */
    @Override
    public int deleteVrApplyByIds(Long[] ids)
    {
        return vrApplyMapper.deleteVrApplyByIds(ids);
    }

    /**
     * 删除用户活动申请信息
     * 
     * @param id 用户活动申请主键
     * @return 结果
     */
    @Override
    public int deleteVrApplyById(Long id)
    {
        return vrApplyMapper.deleteVrApplyById(id);
    }

    @Override
    public int selectActApplyCount(Long id) {
        return vrApplyMapper.selectActApplyCount(id);
    }
}
